<%-- 
    Document   : formAdmin
    Created on : 10-jul-2012, 11:36:56
    Author     : Administrador
--%>
<%@page import="com.javabeans.Carrera"%>
<%@page import="java.util.List"%>
<%@page import="com.javabeans.Usuario"%>
<%@page import="java.util.Calendar"%>
<%
    String s_path = request.getContextPath(); 
    Calendar s_now = Calendar.getInstance();
    String s_param = s_now.get(Calendar.YEAR)+","+s_now.get(Calendar.MONTH)+","+s_now.get(Calendar.DAY_OF_MONTH)+","+s_now.get(Calendar.HOUR_OF_DAY)+","+s_now.get(Calendar.MINUTE)+","+s_now.get(Calendar.SECOND)+","+s_now.get(Calendar.MILLISECOND);
    
    Usuario s_Usuario = null;
    int s_idUsuario = 0;
    String s_nombre = "";
    String s_apellidos = "";
    String s_fechaNac = "";
    String s_foto = "";
    String s_login = "";
    String msg = "";
    if( request.getAttribute("msg") != null ){
        msg = (String) request.getAttribute("msg");
    }
    if( session.getAttribute("s_accesos") != null ){
        s_Usuario = (Usuario)session.getAttribute("s_Usuario");
        s_idUsuario = s_Usuario.getIdUsuario();
        s_nombre = s_Usuario.getNombre();
        s_apellidos = s_Usuario.getApellido();
        s_foto = s_Usuario.getFoto();
        s_login = s_Usuario.getLogin();
    }
    List<Carrera> carreras = (List<Carrera>)request.getAttribute("carreras");
    
    
%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>SI-ESFM</title>
        <meta name="description" content="Derechos Reservados SI-ESFM" />
        <link rel="stylesheet" href="<%=s_path%>/css/styles.css" type="text/css" />
        <link rel="stylesheet" href="<%=s_path%>/css/menu/style.css" type="text/css" />
        <link rel="shortcut icon" href="<%=s_path%>/images/ico.png" type="image/png"/>
        <link rel="stylesheet" href="<%=s_path%>/css/qaptcha/QapTcha.jquery.css" type="text/css" />
        <link rel="stylesheet" href="<%=s_path%>/css/themes/start/jquery-ui-1.8.20.custom.css" type="text/css" />
        
        <script type="text/javascript" src="<%=s_path%>/js/md5.js"></script>
        <script type="text/javascript" src="<%=s_path%>/js/comun.js"></script>
        <script type="text/javascript" src="<%=s_path%>/js/jquery-1.7.2.min.js"></script>
        <script type="text/javascript" src="<%=s_path%>/js/validate/jquery.validate.min.js"></script>
        <script type="text/javascript" src="<%=s_path%>/js/jquery.form.js"></script>
        <script type="text/javascript" src="<%=s_path%>/js/jquery.formalize.min.js"></script>
        
        <script type="text/javascript" src="<%=s_path%>/js/ui/minified/jquery.ui.core.min.js"></script>  <!--si o si cargar esto-->
        <script type="text/javascript" src="<%=s_path%>/js/ui/minified/jquery.ui.widget.min.js"></script>
        <script type="text/javascript" src="<%=s_path%>/js/ui/minified/jquery.ui.datepicker.min.js"></script>
        <script type="text/javascript">
            $(document).ready(function(){                
                $( "#fechaIni" ).datepicker({
                    defaultDate: "+1w",
                    changeMonth: true,
                    changeYear: true,
                    numberOfMonths: 2,
                    onSelect: function( selectedDate ) {
                        $( "#fechaFin" ).datepicker( "option", "minDate", selectedDate );
                    }
		});
		$( "#fechaFin" ).datepicker({
                    defaultDate: "+1w",
                    changeMonth: true,
                    numberOfMonths: 3,
                    onSelect: function( selectedDate ) {
                        $( "#fechaIni" ).datepicker( "option", "maxDate", selectedDate );
                    }
		});
                $('#formBusque').ajaxForm({
                    beforeSubmit: validateForm,
                    beforeSend:function(obj){                        
                        $('#imgLoad').css({display:'block'});
                    },
                    success: function(res, statusText, xhr, form){
                       $("#resAjax").html(res);
                    },
                    complete:function(){
                       $('#imgLoad').css({display:'none'});                       
                    },
                    error:function(){
                       alert("error! al mostrar el foro.");
                    }
		});
            });
            // para mostrar los menus dependiendo d q opcion fue clikado
            function menu(op){
                switch(parseInt(op,10)){
                    case 1:
                        location.href='<%=s_path%>/';
                        break;
                    case 2:
                        location.href='<%=s_path%>/web/index.jsp?tipo=2';
                        break;
                    case 3:
                        location.href='<%=s_path%>/web/index.jsp?tipo=3';
                        break;
                    case 4:
                        location.href='<%=s_path%>/web/index.jsp?tipo=4';
                        break;  
                    case 5:
                        location.href="<%=s_path%>/Foros?accion=1";
                        break;
                }
            }
            function validateForm(formData, jqForm, options) {
                var bandera = $("#formBusque").valid();
                if(!bandera)
                    return false;
            }
        </script>
    </head>
    <body onload="showTime(<%=s_param%>)">
        <div id="top-wrap">
            <div id="header-wrap">
                <div id="header">
                    <h1><a href="index.html"><img src="<%=s_path%>/images/logo.png" alt="logo" height="46" width="190"></a></h1><!-- logo here -->
                    <div style="float: left;height:40px;position:relative; top:27px;">
                        <ul id="css3menu_top" class="topmenu">			
                            <li class="topfirst"><a href="javascript:menu(1)" title="Principal"><img src="<%=s_path%>/css/menu/home.png" alt="home.png"/>Principal</a></li>
                            <li class="topmenu"> <a href="javascript:menu(2)" title="Administrativos"><img src="<%=s_path%>/css/menu/admin.png" alt="admin.png"/>Administrativos</a></li>
                            <li class="topmenu"> <a href="javascript:menu(3)" title="Docentes"><img src="<%=s_path%>/css/menu/docente.png" alt="docente.png"/>Docentes</a></li>
                            <li class="topmenu"> <a href="javascript:menu(4)" title="Estudiantes"><span><img src="<%=s_path%>/css/menu/estudiante.png" alt="Demos"/>Estudiantes</span></a></li>
                            <li class="topmenu"> <a href="javascript:menu(5)" title="Comunidad"><img src="<%=s_path%>/css/menu/postulantes.png" alt="postulante.png"/>Foros</a></li>
                            <li class="toplast"> <a href="#" title="Ayuda"><img src="<%=s_path%>/css/menu/information.png" alt="ayuda"/>Ayuda</a></li>
                        </ul>
                        <p style="display:none"><a href="#">CAR Drop Down CSS Menu Css3.com</a></p><!-- CAR no aparece -->
                        <!--end of navigation-->
                    </div>
                </div>
            </div><!--header ends here-->
            <!-- cuerpo -->
            <div id="bodySpace">
                <!-- aqui va la ruta -->
                <div class="clearfix" id="middle" >
                    <!-- aqui va el arbol de entrada -->
                    <div id="breadcrumb"><!-- le da la forma de la imagen -->
                        <ul>
                            <li><a href="<%=s_path%>/">Home</a></li>
                            <li><span style="color:#666">Foros</span></li>
                            <li class="current-page"><span class="end"><span class="middle">Admin. Foro</span></span></li>
                        </ul>
                        <!-- para la hora -->
                        <div style="clear: both;position: absolute;text-align: right;width: 100%;"><span id="fechaServ"></span>&nbsp;&nbsp;<span id="horaServ" style=""></span>&nbsp;</div>
                    </div><!-- begin SIDEBAR FIRST -->
                </div>
                <div id="principal">
                    <!-- izquierda -->
                    <div class="cuerpo2" style="border: 0px solid">
                        <div class="izq" style="border: 0px solid">
                           <div id="menuprin">
                                <div class="menuIzqMarco">
                                    <div class="menu_css">
                                        <h3 class="title">Seleccione</h3>
                                        <div class="menu_selected menu_selectedDepen">
                                            <ul class="menuLogoNone">
                                                <li class = "pintar">
                                                    <span><a href="Foros?accion=16">Admin. Foro</a></span>
                                                    <span class="end"></span>
                                                </li>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                           </div> 
                        </div>
                        <div class="der" style="border: 0px solid">
                            <div style="clear:left;text-align:center;"><h2 style="color:#004080">Administracion de foro.</h2></div>
                            <span style="float: right"><i><%=s_nombre%>&nbsp;&nbsp;</i><a href="Foros?accion=18"><u><b>Cerrar Sesi&oacute;n</b></u></a></span>                            
                            <form id="formBusque" method="post" action="Foros">
                                <input type="hidden" name="accion" value="19"/>
                                <div style="clear:both;"><br/>
                                    <label for="mycarrera" class="form_align25">Especialidad :</label>
                                    <select name="carrera" id="carrera" class="form_input_align required" title="Seleccione la especialidad." >
                                        <option value="">Seleccione</option>
                                        <%  
                                            
                                            for(Carrera c : carreras){
                                                out.println("   <option value='"+c.getIdCarrera()+"' >"+c.getFacultad().getNombre()+", "+c.getNombre()+"</option>");
                                            }
                                        %>
                                    </select>
                                    <label class="error">*</label>
                                </div>
                                <div style="clear: both">
                                    <label class="form_align25">Fecha :</label>
                                    <input type="text" name="fechaIni" id="fechaIni" value="" class="form_input_align required"placeholder='Pulse aqu&iacute; del.' readonly="" title="Ingrese fecha del."/>
                                    <span style="float:left">&nbsp; Al &nbsp;</span>
                                    <input type="text" name="fechaFin" id="fechaFin" value="" class="form_input_align required" placeholder='Pulse aqu&iacute; al.' readonly="" title="Ingrese fecha al."/>
                                </div>
                                <div style="clear: both">
                                    <label class="form_align25">&nbsp;</label>
                                    <table border="0" style="float: left">
                                        <tr>
                                            <td style="text-align:right"><br/><input type="submit" value="Buscar" class="boton" title="Pulsa aqu&iacute; para buscar." />&nbsp;&nbsp;</td>
                                            <td><br/>&nbsp;&nbsp;</td>
                                        </tr>
                                    </table><br/>&nbsp;
                                </div>
                            </form>
                            <div id="imgLoad" style="float: left;width: 100%;display: none;"><img src="/transporte/images/imgLoad/ajax-loader.gif" width="32" height="32" alt="ajax-loader.gif" style="position:absolute; top:40%; left:50%;"/></div>
                            <div id="resAjax" style="clear: both;"></div>
                        </div>
                    </div><!--end of leftPan-->
                </div>
            </div>
        </div>
    </body>
</html>
